import React from 'react';
import moment from 'moment';
import PrivateRoute from './PrivateRoute';
import 'moment/locale/zh-cn';
moment.locale('zh-cn');
const excludes = ['/login', '/register', '/resetPassword', '/register/agreement'];
export default ({ location: { pathname }, location, children, route }) => {
  if (excludes.includes(pathname)) {
    return <>{children}</>;
  }
  return (
    <PrivateRoute location={location} route={route}>
      {children}
    </PrivateRoute>
  );
};
